﻿using MediatR;
using SheepStorage.API.Application.Command.ProvinceCommand;
using SheepStorage.API.Application.Command.RoleManCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.RoleManHandler
{
	public class RoleShowHandler : IRequestHandler<RoleShowCommand, Results<List<Role>>>
	{

	private	 readonly IRolesService service;

		public RoleShowHandler(IRolesService service)
		{
			this.service = service;
		}




		public async Task<Results<List<Role>>> Handle(RoleShowCommand request, CancellationToken cancellationToken)
		{
			//throw new NotImplementedException();
			var rolelist=await  service.GetAllRoles(request.RoleName);
		 
			return Results<List<Role>>.DataResult(rolelist);

		}
	}
}
